package com.xce.order.interceptor;

import feign.InvocationContext;
import feign.Response;
import feign.ResponseInterceptor;
import feign.codec.Decoder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @ClassName ProductInterceptor
 * @Description TODO
 * @Author lld
 * @Date 2025/7/1 17:40
 * @Version 1.0
 */
@Slf4j
@Component
public class ProductInterceptor implements ResponseInterceptor {
    @Override
    public Object intercept(InvocationContext invocationContext, Chain chain) throws Exception {


        Response response = invocationContext.response();
        Decoder decoder = invocationContext.decoder();
        Object proceed = invocationContext.proceed();
        log.info("相应处理前body: {}",response);
        log.info("相应处理前decoder: {}",decoder);
        log.info("相应处理前proceed: {}",proceed); // 是响应体
        Object response2 = chain.next(invocationContext);
        log.info("response2：{}",response2);
        return response2;
    }

}
